package stripes;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class reducer extends Reducer<Text, TextStripe, Text, TextStripe> {

    @Override
    public void reduce(Text inputKey, Iterable<TextStripe> inputValues, Context context)
            throws IOException, InterruptedException {
        //创建一表示总和的TexStripe
        TextStripe sumStripe = new TextStripe();
        for(TextStripe ts : inputValues) {
            //将对应的列表加入总列表里
            sumStripe.putAll(ts);
        }
        context.write(inputKey, sumStripe);
    }
}

